<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/react/16.8.4/umd/react.development.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-dom/16.8.4/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/prop-types/15.8.1/prop-types.js"></script>
  </head>
  <body>
    <div id="test"></div>
    <script type="text/babel">
      class Show extends React.Component {
        container = React.createRef();
        show = () => {
          console.log(this.container);
        };
        render() {
          console.log("render");
          return (
            <div>
              <input type="text" ref="inpu" />
              <button onClick={this.show}>点击</button>
              <input type="text" ref={(dom) => (this.x = dom)} />
              <div ref={this.container}>Orange</div>
              <div ref={this.container}>Green</div>
            </div>
          );
        }
      }
      ReactDOM.render(<Show />, document.getElementById("test"));
    </script>
  </body>
</html>
